﻿@model IEnumerable<AppNet.Models.Category>

<style>
    .display-table th
    {
        padding: 10px;
    }
    
</style>

@{
    ViewBag.Title = "Index";
}

<h2>@AppNet.MultiLanguage.Translation.GetInstance.Translate("CategoryTitle")</h2>

<p>
    @Html.ActionLink(@AppNet.MultiLanguage.Translation.GetInstance.Translate("CreateNewBtn"), "Create")
</p>
<table class="display-table">
    <tr>
        <th>
          @AppNet.MultiLanguage.Translation.GetInstance.Translate("Title")
        </th>
          <th>
          @AppNet.MultiLanguage.Translation.GetInstance.Translate("CatIsRoot")
        </th>
        <th>
          @AppNet.MultiLanguage.Translation.GetInstance.Translate("CatRoot")
        </th>
       
        <th>
        @AppNet.MultiLanguage.Translation.GetInstance.Translate("CatVisible")
        </th>
      
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td>
           @if (item.IsRoot == true)
           {
            <p>True</p>
           }
           else
           {
            <p>False</p>
           }
        </td>
        <td>
        @foreach (var i in Model)
        {
            if (item.RootID == i.ID)
            {
                <p>@i.Title</p>
            }
        }
        </td>
        <td>
        @if (item.IsVisible == true)
        {
            <p>Visible</p>
        }
        else
        {
            <p>Invisible</p>
        }
           
        </td>
        <td>
            @Html.ActionLink(@AppNet.MultiLanguage.Translation.GetInstance.Translate("CreateSub"), "CreateSubCategories", new { id = item.ID }) |
            @Html.ActionLink(@AppNet.MultiLanguage.Translation.GetInstance.Translate("Edit"), "Edit", new { id = item.ID }) |
            @Html.ActionLink(@AppNet.MultiLanguage.Translation.GetInstance.Translate("Delete"), "Delete", new { id = item.ID })
        </td>
    </tr>
}

</table>
